﻿using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.Windows;
using Microsoft.Practices.Composite.Events;
using Microsoft.Practices.Composite.MefExtensions;

namespace MefBasic
{
    public class MefBasicBootstrapper : MefBootstrapper
    {
        protected override DependencyObject CreateShell()
        {
            Container.ComposeExportedValue(new ShellPresenter(new ShellView(),Container.GetExportedValue<IEventAggregator>()));
            return (DependencyObject)Container.GetExportedValue<ShellPresenter>().View;
        }
        
        public new CompositionContainer Container
        {
            get { return base.Container; }
        }

        protected override void ConfigureAggregateCatalog()
        {
            base.ConfigureAggregateCatalog();
            AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(MefBasicBootstrapper).Assembly));
        }
    }
}
